import yaml


class YamlAnalysis():
    # 解析yaml文件
    @classmethod
    def parse_yaml(cls, filepath):
        with open(filepath, encoding='utf-8') as f:
            return yaml.safe_load(f)

    # 返回数据
    @classmethod
    def return_yaml_data(cls, filepath, data):
        return cls.parse_yaml(filepath)[data]

    #写入yaml文件
    @classmethod
    def write_yaml(cls, filepath, data):
        with open(filepath, "w", encoding='utf-8') as f:
            yaml.dump(data, f)

    #根据key值写入对应的yaml文件
